<?php
	####################################################
	# library import and object instance.              #
	####################################################
	include_once('./common.php');


	####################################################
	# request data($_POST AND $_GET FROM $_REQUEST)    #
	####################################################
	# REQUEST(get and post variables)

	# GET(url variables)

	# POST(form variables)

	# Validation(special case validate)

	####################################################
	# implementation                                   #
	####################################################
	//*/
	# 로그인 체크
	if($sess['has']){
		Mover::home('이미 로그인 되어 있습니다.', NULL, TRUE);
	}

	# 로그인 지속
	$sign_duration_cookie = Cookier::get("sign_duration_cookie");
	if($sign_duration_cookie) {
		$decompose_sign_duration = Cookier::decompose($sign_duration_cookie);
		$duration_y = $decompose_sign_duration[0];
		$duration_id = Cipher::decrypt( $decompose_sign_duration[1] );
		//Nlog::xmp( $sign_duration_cookie );
		//Nlog::xmp( $decompose_sign_duration );
		//Nlog::xmp( $duration_id );
	}
	//*/
?>
<?php
	$html->custom_header(TITLE);
	$html->custom_js("{$JS}jquery.1.7.1.min.js");
	$html->custom_js("{$JS}lib.control.js");
	$html->custom_css("{$CSS}basic.css");
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
	var PageAction = {
		validate:function(){
			//*/
			var check = [
				Validation.check_is_null("#mid", "아이디를 입력하세요."),
				Validation.check_is_idpw("#mid", "아이디를 형식에 맞게 입력하세요."),
				Validation.check_is_null("#mpasswd", "비밀번호를 입력하세요."),
				Validation.check_is_idpw("#mpasswd", "비밀번호를 형식에 맞게 입력하세요.")
			];
			return Validation.check(check);
			//*/
		}
	}
//]]>
</script>
<?$html->custom_body();?>
<?=$tmp->tiles_header()?>
	<h1>로그인</h1>
	<form id="formx" name="formx" method="post" action="./sign_login_proc.php" onsubmit="return PageAction.validate();">
		<table width="100%" border="1" cellspacing="3" cellpadding="0">
			<tr>
				<th>
					아이디
				</th>
				<td>
					<input type="text" name="mid" id="mid" maxlength="40" value="<?=@$duration_id?>"/>
				</td>
			</tr>
			<tr>
				<th>
					비밀번호
				</th>
				<td>
					<input type="password" name="mpasswd" id="mpasswd" />
				</td>
			</tr>
			<tr>
				<th>
					로그인 지속
				</th>
				<td>
					<label>
						<input type="checkbox" id="sign_duration" name="sign_duration" value="y" <?=NForm::checked($duration_y, 'y');?> /> 다음 로그인때 아이디를 기억 하겠습니다.
					</label>
				</td>
			</tr>
			<tr>
				<th colspan="2">
					<?=NTool::submit_btn();?>
				</th>
			</tr>
		</table>
	</form>
	<?=NTool::btn("뒤로", "Mover.back();");?>
	<?=NTool::btn("인덱스", "Mover.home();");?>
<?=$tmp->tiles_footer()?>
<?php $html->html_footer(); ?>